/*
 * Copyright 2011 Stefan Ferstl
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.code.debmavenplugin.archiver;

import java.io.File;

/**
 * Archive metadata that excludes all files in its base directories except the
 * explicitly defined special files.
 */
public class SpecialFileArchiveMetaData extends ArchiveMetaData {

  /**
   * Constructor.
   * @param baseDirectory The base directory of the archive's content. Must not
   *        be <code>null</code>.
   * @param userName Default user who ownes all the directories and files in the
   *        archive.
   * @param groupName Default group who ownes all the directories and files in
   *        the archive.
   * @param dirMode Default directory mode.
   * @param fileMode Default file mode.
   */
  public SpecialFileArchiveMetaData(File baseDirectory, String userName, String groupName, Integer dirMode, Integer fileMode) {
    super(baseDirectory, userName, groupName, dirMode, fileMode);
  }

  /**
   * Returns only <code>true</code> if the given file is defined as special
   * file.
   * @param file The file to check for exclusion.
   */
  @Override
  public boolean isExcluded(File file) {
    return !isSpecialFile(file);
  }

}
